From c724d70275cfd1256889283aeed99275dfc083e7 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 18 Aug 2006 16:20:45 +0100 Subject: [PATCH] [HVM] Fix the APM BIOS to ensure that interrupts are enabled when it executes an idling HLT. This allow us to re-enable the 'shutdown on HLT-with-interrupts-disabled' heuristic. Signed-off-by: Keir Fraser --- tools/firmware/rombios/apmbios.S | 3 +++ xen/arch/x86/hvm/hvm.c | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/firmware/rombios/apmbios.S b/tools/firmware/rombios/apmbios.S index df8e106129..a010949f7d 100644 --- a/tools/firmware/rombios/apmbios.S +++ b/tools/firmware/rombios/apmbios.S @@ -225,7 +225,10 @@ APMSYM(04): APMSYM(05): cmp al, #0x05 jne APMSYM(07) + pushf ; XEN + sti ; XEN: OS calls us with ints disabled -- better re-enable here! hlt + popf ; XEN jmp APMSYM(ok) ;----------------- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 2e78d2fe6b..48806c000e 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -345,13 +345,13 @@ int cpu_get_interrupt(struct vcpu *v, int *type) return -1; } +#include void hvm_hlt(unsigned long rflags) { struct vcpu *v = current; struct periodic_time *pt = &v->domain->arch.hvm_domain.pl_time.periodic_tm; s_time_t next_pit = -1, next_wakeup; -#if 0 /* This seems to fire at unwelcome times in Linux */ /* * Detect machine shutdown. Only do this for vcpu 0, to avoid potentially * shutting down the domain early. If we halt with interrupts disabled, @@ -360,12 +360,11 @@ void hvm_hlt(unsigned long rflags) */ if ( (v->vcpu_id == 0) && !(rflags & X86_EFLAGS_IF) ) { - printk("D%d: HLT with interrupts enabled -- shutting down.\n", + printk("D%d: HLT with interrupts disabled -- shutting down.\n", current->domain->domain_id); domain_shutdown(current->domain, SHUTDOWN_poweroff); return; } -#endif /* 0 */ if ( !v->vcpu_id ) next_pit = get_scheduled(v, pt->irq, pt); -- 2.30.2